
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> 用户管理 >> 用户列表</title>
	<script type="text/javascript" src="${base}/admin/js/jquery-1.7.min.js"></script>
	<script type="text/javascript" src="${base}/admin/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
	<link rel="stylesheet" type="text/css" href="${base}/admin/fancybox/jquery.fancybox-1.3.4.css" media="screen" />
	<link rel="stylesheet" href="${base}/admin/css/tableStyle.css" type="text/css"></link>
	<script type="text/javascript" src="${base}/admin/js/tableJs.js"></script>
	
	<style type="text/css">
	
	</style>
</head>
<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="34" bgcolor="#353c44"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="6%" valign="center">
                	<div align="center"><img src="images/tb.gif" width="14" height="14" /></div></td>
                <td width="44%" valign="center">
                	<span class="STYLE1">品牌管理&nbsp;>>&nbsp;品牌列表</span>
                </td>
                <td width="50%">
                	<form action="brand_search.action" method="post">
                		<input type="text" name="keyword" value="${keyword!''}" placeholder="请输入关键字搜索" />
                		<input type="submit" value="搜索" />
                	</form>
                </td>
              </tr>
            </table></td>
            <td><div align="right"><span class="STYLE1">
              	<span class="operate">
              	<img src="images/add.gif" width="10" height="10" /><span class="operate">
              		<a href="brand_input.action?<#if cid??>cid=${cid!''}</#if>" >添加</a></span>   &nbsp; 
              	<span class="operate">
              		<img src="images/del.gif" width="10" height="10" />
              		<a href="javascript:deleteSelected()" >删除</a></span>&nbsp; 
            	</div>
            </td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#a8c7ce" onmouseover="changeto()"  onmouseout="changeback()">
      <tr>
        <th width="4%" class="columnTitle"><input type="checkbox" name="checkbox11" id="checkbox11" onclick="selectAll(this)" value="${(brand.id)!''}"/></th> 
        <th width="15%" class="columnTitle"><span>品牌</span></th>
         <th width="10%" class="columnTitle"><span>创建者</span></th>
        <th width="5%" class="columnTitle"><span>得分</span></th>
         <th width="5%" class="columnTitle"><span>信誉</span></th>
          <th width="20%" class="columnTitle"><span>推荐</span></th>
          <th width="10%" class="columnTitle"><span>在线店铺(家)</span></th>
           <th width="10%" class="columnTitle"><span>实体店铺(家)</span></th>
        <th width="*" class="columnTitle"><span>基本操作</span></th>
      </tr>
       <form id="brandsForm">
      <#list brandList as brand>     
      <tr>
        <td class="cellContent"><input type="checkbox" name="brandIdList" id="brandIdList" value="${(brand.id)!''}"/></td>
        <td class="cellContent">${(brand.name)!''}</td>
         <td class="cellContent">${(brand.creator)!''}</td>
         <td class="cellContent">${(brand.score)!''}</td>
        <td class="cellContent">${(brand.credit)!''}</td>
        <td class="cellContent">
        	<select id="level_${brand_index}" style="width:75px" class="level">
        		<option value="0">--推荐--</option>
        		<option value="1">一级</option>
        		<option value="2">二级</option>
        		<option value="3">三级</option>
        		<option value="4">四级</option>
        		<option value="5">五级</option>
        	</select>
        	<a href="#" onclick="commend('${(brand.id)!''}',this)">推荐</a>
        	<img style="display:none;margin-right:0px" src="images/commendOk.png" id="img_${brand_index}" width="12" height="12"  />
        	<script type="text/javascript" >
        		document.getElementById("level_${brand_index}").options[${(brand.level)!'0'}].selected=true;
        	</script>
        </td>
        <td class="cellContent">${(brand.onlineStoreCount)!''}&nbsp;|<a href="onLineStore_list.action?brandId=${(brand.id)!''}" >管理</a></td>
        <td class="cellContent">${(brand.realStoreCount)!''}&nbsp;|<a href="realStore_list.action?brandId=${(brand.id)!''}" >管理</a></td>
        
        <td class="cellContent">
        	<a href="javascript:deleteById('${(brand.id)!''}','${(brand.name)!''}');">删除</a>  
        	<a href="brand_view.action?id=${(brand.id)!''}">查看</a> 
        	<a href="http://www.ppyeah.com/brand.html?id=${(brand.id)!''}" target="_blank">前台查看</a> 
        	<a href="brand_edit.action?id=${(brand.id)!''}&sendUrl=${pageBar.getPageUrl(pageBar.getCurrPageNo())}" >编辑</a>
        </td>
      </tr>
      
      </#list>
      </form>
      
    </table></td>
  </tr>
  <tr>
    <td height="30"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="33%">
        	<div align="left">
        		<span class="STYLE22">&nbsp;&nbsp;&nbsp;&nbsp;
        		共有<strong> ${pageBar.getTotalRecordCount()} </strong> 条记录，
        		当前第<strong>${pageBar.getCurrPageNo()}</strong> 页，
        		共 <strong>${pageBar.getTotalPageCount()}</strong> 页</span></div></td>
        <td width="67%"><table width="312" border="0" align="right" cellpadding="0" cellspacing="0">
          <tr>
            <td width="49"><div align="center">
            	<#if (pageBar.getFirstPageUrl()?length>0) >
				<a href="${pageBar.getFirstPageUrl()}"><img src="images/main_54.gif" width="40" height="15" /></a>
				<#else>
            	<img src="images/main_54.gif" width="40" height="15" />
				</#if>
            </div></td>
            <td width="49"><div align="center">
            	<#if (pageBar.getPriorPageUrl()?length > 0) >
				<a href="${pageBar.getPriorPageUrl()}"><img src="images/main_56.gif" width="45" height="15" /></a>
				<#else>
            	<img src="images/main_56.gif" width="45" height="15" />
				</#if>
            </div></td>
            <td width="49"><div align="center">
            	
            	<#if (pageBar.getNextPageUrl()?length>0) >
				<a href="${pageBar.getNextPageUrl()}"><img src="images/main_58.gif" width="45" height="15" /></a>
				<#else>
				<img src="images/main_58.gif" width="45" height="15" />
				</#if>
            </div></td>
            <td width="49"><div align="center">
            	<#if (pageBar.getLastPageUrl()?length>0) >
				<a href="${pageBar.getLastPageUrl()}"><img src="images/main_60.gif" width="40" height="15" /></a>
				<#else>
            	<img src="images/main_60.gif" width="40" height="15" />
				</#if>
            </div></td>
            <td width="37" class="STYLE22"><div align="center">转到</div></td>
            <td width="22"><div align="center">
              <input type="text" name="textfield" id="text_goto"  style="width:20px; height:12px; font-size:12px; border:solid 1px #7aaebd;"/>
            </div></td>
            <td width="22" class="STYLE22"><div align="center">页</div></td>
            <td width="35">
            	<#if (pageBar.getTotalPageCount()>1) >
            	<a href="javascript:goto();"><img src="images/main_62.gif" width="26" height="15" /></a>
				<#else>
            	<img src="images/main_62.gif" width="26" height="15" />
				</#if>
            </td>
            <script type="text/javascript">
            	function goto(){
            		var value=$("#text_goto").val();
            		var re = /^[1-9]\d*$/;
            		if(re.test(value)){
            			if(value>${pageBar.getTotalPageCount()}||value<1){
            				alert("输入超过限制！");
            			}else{
            				location.href="${pageBar.getPageUrlNoPageNumber()}"+value;
            			}
            		}else{
            			alert("输入格式错误！");
            			$("#text_goto").val("");
            		}
            	}
            </script>
            
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>


<script type="text/javascript">
		$(document).ready(function() {
			$(".showdialog").fancybox({
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type'				: 'iframe',
				'hideOnOverlayClick': false,
				'callbackOnClose'	: function(){alert("关闭");}
			});
		});
		function deleteById(id,name){
			if(confirm("确定要删除品牌【 "+name+" 】吗？此操作装无法恢复！")){
				$.post("brand_delete.action",{'id':id},function(data){
					data=eval(data);
					if(data[0].status=="success"){
						alert(data[0].message);
						history.go(0);
					}else{
						alert(data[0].message);
					}
				});
			}
		}
		
		function selectAll(obj){
	        var chk=document.getElementsByName("brandIdList");   
	        for(var i=0;i<chk.length;i++){   
	           chk(i).checked=obj.checked; 
	        }   
     	 }
       
        function getCount(){
       		var count=0;
       		var chk=document.getElementsByName("brandIdList"); 
	        for(var i=0;i<chk.length;i++){   
	           if(chk(i).checked){
	           		count++;
	           }
	        } 
	        return count;
       }
       
       
       function deleteSelected(){
       		var parameter = $("#brandsForm").serialize();
       		var count=getCount();
       		if(count<=0){
       			alert("请选择要删除的用户!");
       			return false;
       		}
       		if(confirm("确定要删除所选的 "+(count===2?"两":count)+" 个用户吗？此操作将无法恢复！")){
	       		$.post("brand_deleteSelect_ajax.action",parameter,function(data){
	       			data=eval("("+data+")");
	       			if(data["status"]==="success"){
	       				alert("成功删除"+(data["count"]===2?"两":data["count"])+"条数据!");
	       				
	       			}else{
	       				alert(data["message"]);
	       			}
	       			history.go(0);
	       		});
       		}
       }
       
       //推荐品牌
       function commend(id,obj){
       		var selectValue=$(obj).prev().val();
       		$.post("brand_commend.action?id="+id+"&level="+selectValue,function(data){
	       			data=eval("("+data+")");
	       			if(data["status"]==="success"){
	       				$(obj).next("img").show(1000);
	       				window.setTimeout( function(){
       										$(obj).next("img").hide(2000)
      										 },3000);
	       				
	       			//	history.go(0);
	       			}else{
	       				alert("推荐失败!");
	       			}
	       			
	       		});
       }
       
       
      
       
</script>

</body>
</html>